<template>
  <div>
    <elm-page-lr width="300px">
      <template #left>
        <elm-page-tb :splite="false">
          <template #top>
            <el-input placeholder="请查询输入内容" prefix-icon='el-icon-search' size="mini" v-model="filterText" @change="treebinding()" style="width:100%;"></el-input>
          </template>
          <elm-table-tree url="/business/hrm/ei/GetOrgTree" :post-data="{ name:filterText }" :show-header="false" style="user-select:none;"
                          @row-click="rowClick" :unshift="{ id: null, name: '全部' }" :default-expand-all="true" height="100%" :page-size="9999">
            <el-table-column>
              <template v-slot="scope">
                <template v-if="scope.row.children">
                  <i class="el-icon-folder-opened" style="color:#0094ff;"></i>
                </template>
                <template v-else>
                  <i class="el-icon-tickets" style="color:#0094ff;"></i>
                </template>
                {{scope.row.name}}
              </template>
            </el-table-column>
          </elm-table-tree>
        </elm-page-tb>
      </template>
      <elm-page-tb>
        <template #top>
          <el-input placeholder="请查询输入内容" size="mini" prefix-icon='el-icon-search' style="width:250px;" v-model="postData.name" clearable></el-input>
          <right>
            <el-button-group>
              <el-button icon="el-icon-search" size="mini" @click="tablebinding()">查询</el-button>
              <elm-open-button url="ei_edit" title="新增"  width="900" height="700">新增</elm-open-button>
            </el-button-group>
          </right>
        </template>
        <elm-table url="/business/hrm/ei/GetData" :post-data="postData">
          <el-table-column prop="emp_code" label="工号" align="center" width="60"></el-table-column>
          <el-table-column label="头像" align="center" width="50">
            <template v-slot="scope">
              <img :src='"/api/system/login/io/Viewer/biz_hrm_ei_basic_avatar/"+scope.row.id+"?token="+elm.info.token'
                   style="width:29px;height:29px;margin-top:3px;margin-bottom:3px" />
            </template>
          </el-table-column>
          <el-table-column prop="name" label="姓名" align="center" width="150"></el-table-column>biz_hrm_ei_basic
          <el-table-column prop="sex" label="性别" align="center"  width="100"></el-table-column>
          <el-table-column prop="politics_status" label="政治面貌" align="center"  width="120"></el-table-column>
          <el-table-column prop="phone" label="联系电话" align="left" header-align="center"></el-table-column>
          <el-table-column prop="enter_company_date" label="入职时间" align="center"  width="150"></el-table-column>
          <el-table-column prop="work_status" label="用工状态" align="center"  width="100"></el-table-column>
          <el-table-column prop="remark" label="备注"></el-table-column>
          <el-table-column fixed="right" label="操作" width="180px" align="center">
            <template v-slot="scope">
              <elm-open-button theme="white" url="ei_record" title="档案" width="1000" height="90%" :data="{ model: scope.row }" type="text">档案</elm-open-button>
              <elm-open-button url="ei_edit" title="编辑"   width="900" height="700" :data="{ model: scope.row }" type="text">编辑</elm-open-button>
              <elm-delete-button  type="text" size="mini" url="/business/hrm/ei/Delete" :data="{ id: scope.row.id }">删除</elm-delete-button>
            </template>
          </el-table-column>
        </elm-table>
      </elm-page-tb>
    </elm-page-lr>
  </div>

</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      filterText: '',
      postData: { org: null, name: null},
      timestamp:new Date().getTime()
    }
  },
  created() {
  },
  methods: {
    rowClick(row) {
      this.postData.org = row.id;
      this.tablebinding();
      this.timestamp = new Date().getTime();
    }
  }
}
</script>
